﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SzCourt.Logic.BLL;
using SzCourt.Logic.NBL.DBEntities;

namespace SzCourt.WebSite.manager
{
    public partial class news_detail_examine : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                getInfo();
            }
        }

        private void getInfo()
        {
            int _id = string.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"]);
            this.hdnID.Value = _id.ToString();
            ReporterHome bll = new ReporterHome();
            pReporterHomeInfo result = (pReporterHomeInfo)bll.GetInfo(_id);
            if (result != null)
            {
                this.hTitle.InnerHtml = result.Title;
                this.sdate.InnerHtml = result.AddDateTime.ToString();
                this.divContent.InnerHtml = result.Content;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
             string UserName= AdminSession.SessionBox.GetUserSession().UserName;
             if (UserName.ToLower().StartsWith("jzxw") || UserName.ToLower().StartsWith("sysadmin") || UserName.ToLower().StartsWith("liang"))
             {
                 int _id = string.IsNullOrEmpty(this.hdnID.Value) ? 0 : Convert.ToInt32(this.hdnID.Value);
                 ReporterHome bll = new ReporterHome();
                 bool result = (bool)bll.AuditInfo(_id);
                 this.divMessages.Visible = true;
                 if (result)
                 {
                     this.divMessages.InnerHtml = "审核成功!";
                 }
                 else
                 {
                     this.divMessages.InnerHtml = "审核失败!";
                 }
             }             
            else
            {
                this.divMessages.InnerHtml = "审核失败！没有记者之家新闻审核权限！";
            }
        }

    }
}